package com.ys.erp.entity.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.ys.erp.entity.service.IShopService;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.ArrayList;
import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ys.erp.entity.mapper.ShopMapper;
import com.ys.erp.entity.data.bean.Shop;

/**
 * @author lwj
 * @date 2025/5/19
 */

@Service
public class IShopServiceImpl extends ServiceImpl<ShopMapper, Shop> implements IShopService {

    @Override
    public Shop getByCode(String shopCode) {
        QueryWrapper<Shop> shopQw = new QueryWrapper<>();
        shopQw.lambda().eq(Shop::getShopCode, shopCode);
        return this.getOne(shopQw);
    }

    @Override
    public List<Shop> getShopListByCodeList(List<String> shopCodeList) {
        if (CollectionUtils.isEmpty(shopCodeList)) {
            return new ArrayList<>();
        }
        QueryWrapper<Shop> shopQw = new QueryWrapper<>();
        shopQw.lambda().in(Shop::getShopCode, shopCodeList);
        return this.list(shopQw);
    }

}
